package horncomb.bpm.process.def.activity;

import horncomb.bpm.process.core.ExecutionContext;
import horncomb.bpm.task.core.TaskAssignment;
import horncomb.bpm.task.core.TaskInstanceCreator;
import horncomb.bpm.task.def.DefaultTaskDefinition;

/**
 * @author Daniel
 */
public class SimpleTaskActivityDefinition extends AbstractActivityDefinition {
	private static final long serialVersionUID = -6031252116698732368L;
	protected DefaultTaskDefinition taskDefinition = new DefaultTaskDefinition();

	/**
	 * @param id
	 */
	public SimpleTaskActivityDefinition(String id) {
		super(id);
		this.taskDefinition.setId(id);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void doEnteringAction(ExecutionContext context) {
		this.taskDefinition.newInstance(context.getToken(), context
				.getContextModel());
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String getId() {
		return this.taskDefinition.getId();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void setId(String id) {
		this.taskDefinition.setId(id);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String getName() {
		return this.taskDefinition.getName();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void setName(String name) {
		this.taskDefinition.setName(name);
	}

	/**
	 * @param taskAssignment
	 *            the taskAssignment to set
	 */
	public void setTaskAssignment(TaskAssignment taskAssignment) {
		this.taskDefinition.setTaskAssignment(taskAssignment);
	}

	/**
	 * @return the taskAssignment
	 */
	public TaskAssignment getTaskAssignment() {
		return this.taskDefinition.getTaskAssignment();
	}

	/**
	 * @return the taskCreator
	 */
	public TaskInstanceCreator getTaskInstanceCreator() {
		return this.taskDefinition.getTaskInstanceCreator();
	}

	/**
	 * @param taskInstanceCreator
	 *            the taskCreator to set
	 */
	public void setTaskInstanceCreator(TaskInstanceCreator taskInstanceCreator) {
		this.taskDefinition.setTaskInstanceCreator(taskInstanceCreator);
	}

	/**
	 * @return the taskDefinition
	 */
	public DefaultTaskDefinition getTaskDefinition() {
		return taskDefinition;
	}
}
